{extend name="template/pc/cms-red/_base.html" /}

{block name="css"}
<link rel="stylesheet" type="text/css" href="__STATIC__/admin/hui/static/h-ui/css/Validform_msg.css"/>
{/block}

{block name="main"}

<div class="container content">

    <div class="contact-box">

        <div class="contact-box-title">
            {$fname_nav}
        </div>

        <div class="contact-box-ztitle">
            域名查询
        </div>

        <div class="contact-box-hr"></div>

        <div class="contact-box-cont">

            <form name="form" method="post" action="" id="form" class="form">

                <div class="d-search">

                    <div class="domain-search">

                        <div class="input-box"><input type="text" name="dns" id="dns" placeholder="查询的域名"
                                                      class="input-text" maxlength="63"></div>
                        <input class="search-btn" id="searchBtn" value="立即查询" type="submit"/>

                        <div class="domain-root">

                            <div class="domainType domainType-0 current">
                                <label><input type="checkbox" name="ext[]" value="com">.com</label>
                                <label><input type="checkbox" name="ext[]" value="cn">.cn</label>
                                <label><input type="checkbox" name="ext[]" value="tel">.tel</label>

                                <label><input type="checkbox" name="ext[]" value="mobi">.mobi</label>
                                <label><input type="checkbox" name="ext[]" value="net">.net</label>
                                <label><input type="checkbox" name="ext[]" value="org">.org</label>

                                <label><input type="checkbox" name="ext[]" value="asia">.asia</label>
                                <label><input type="checkbox" name="ext[]" value="me">.me</label>
                                <label><input type="checkbox" name="ext[]" value="com.cn">.com.cn</label>

                                <label><input type="checkbox" name="ext[]" value="net.cn">.net.cn</label>
                                <label><input type="checkbox" name="ext[]" value="org.cn">.org.cn</label>
                                <label><input type="checkbox" name="ext[]" value="gov.cn">.gov.cn</label>

                                <label><input type="checkbox" name="ext[]" value="hk">.hk</label>
                                <label><input type="checkbox" name="ext[]" value="tv">.tv</label>
                                <label><input type="checkbox" name="ext[]" value="biz">.biz</label>

                                <label><input type="checkbox" name="ext[]" value="cc">.cc</label>
                                <label><input type="checkbox" name="ext[]" value="name">.name</label>
                                <label><input type="checkbox" name="ext[]" value="info">.info</label>

                                <label><input type="checkbox" name="ext[]" value="top">.top</label>
                                <label><input type="checkbox" name="ext[]" value="shop">.shop</label>

                                <label><input type="checkbox" name="ext[]" value="公司">.公司</label>
                                <label><input type="checkbox" name="ext[]" value="网络">.网络</label>
                                <label><input type="checkbox" name="ext[]" value="中国">.中国</label>
                            </div>

                        </div>

                    </div>

                    <div class="result">

                        <div class="result-panel">

                            <div class="result-title">查询结果</div>

                            <div class="result-cont">
                                <div class="result-item">{$domain_name['name'] ?? ''}{$domain_name['value'] ?? ''}
                                </div>
                            </div>

                        </div>

                    </div>

                </div>

            </form>

        </div>

    </div>

</div>

{/block}

{block name="js"}
<!-- AJAX -->
<script src="__STATIC__/hanbang/js/jquery.form.js"></script>
<script src="__STATIC__/hanbang/js/ajax.js"></script>
<script type="text/javascript">
    $(function () {
        $('#form').on('submit', function () {

            $('.result-item').remove();

            var form = $(this);

            jQuery.ajax({
                url: "{:url(\'domain/index\')}",
                type: 'post',
                data: form.serialize(),
                dataType: 'json',
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                },


                success: function (data) {
                    var item = eval(data);
                    for (var i = 0; i < item.length; i++) {
                        $('.result-cont').append('<div class="result-item">' + item[i].name + ' ' + item[i].value + '</div>');
                    }
                    return true;
                }
            });

            return false;
        });
    })
</script>
{/block}